package com.itheima.service.impl;

import com.itheima.dao.UserDao;
import com.itheima.dao.impl.UserDaoImpl;
import com.itheima.domain.User;
import com.itheima.service.UserService;

import java.util.List;

/**
 * 事务
 * 分页
 * ...
 */
public class UserServiceImpl implements UserService {
    @Override
    public List<User> findAll() {
        UserDao userDao = new UserDaoImpl();
        return userDao.findAll();
    }

    @Override
    public void save(User user) {
        UserDao userDao = new UserDaoImpl();
        userDao.save(user);
    }

    @Override
    public void deleteById(String id) {
        UserDao userDao = new UserDaoImpl();
        userDao.deleteById(id);
    }


    @Override
    public User findById(String id) {
        UserDao userDao = new UserDaoImpl();
        return userDao.findById(id);
    }

    @Override
    public void update(User u) {
        UserDao userDao = new UserDaoImpl();
        userDao.update(u);
    }
}
